<template>
  <div class="admin-page">
    <h1>管理员控制台</h1>
    <p>欢迎来到管理员控制台，您拥有最高权限，可以管理所有功能</p>

    <el-row :gutter="20">
      <el-col :span="8">
        <el-card>
          <template #header>
            <span>基础管理</span>
          </template>
          <div>
            <el-button type="primary" @click="handlePosition">岗位管理</el-button>
            <el-button type="success" @click="handleCategory">分类管理</el-button>
            <el-button type="warning" @click="handleTag">标签管理</el-button>
            <el-button type="info" @click="handleCompany">公司管理</el-button>
          </div>
        </el-card>
      </el-col>

      <el-col :span="8">
        <el-card>
          <template #header>
            <span>内容管理</span>
          </template>
          <div>
            <el-button type="primary" @click="handleResume">简历管理</el-button>
            <el-button type="success" @click="handleComment">评论管理</el-button>
            <el-button type="warning" @click="handleUser">用户管理</el-button>
          </div>
        </el-card>
      </el-col>

      <el-col :span="8">
        <el-card>
          <template #header>
            <span>运营管理</span>
          </template>
          <div>
            <el-button type="primary" @click="handleAdvertisement">广告管理</el-button>
            <el-button type="success" @click="handleNotification">通知管理</el-button>
            <el-button type="warning" @click="handleTest">连接测试</el-button>
          </div>
        </el-card>
      </el-col>
    </el-row>

    <el-row :gutter="20" style="margin-top: 20px">
      <el-col :span="12">
        <el-card>
          <template #header>
            <span>日志管理</span>
          </template>
          <div>
            <el-button type="primary" @click="handleLoginLog">登录日志</el-button>
            <el-button type="success" @click="handleOperationLog">操作日志</el-button>
            <el-button type="warning" @click="handleErrorLog">错误日志</el-button>
          </div>
        </el-card>
      </el-col>

      <el-col :span="12">
        <el-card>
          <template #header>
            <span>统计分析</span>
          </template>
          <div>
            <el-button type="primary" @click="handleStatistics">数据统计</el-button>
            <el-button type="success" @click="handleAnalysis">数据分析</el-button>
          </div>
        </el-card>
      </el-col>
    </el-row>

    <!-- 企业功能模块 -->
    <el-row :gutter="20" style="margin-top: 20px">
      <el-col :span="12">
        <el-card>
          <template #header>
            <span>企业功能管理</span>
          </template>
          <div>
            <el-button type="primary" @click="handleDeliveryManagement">投递管理</el-button>
            <el-button type="success" @click="handlePositionManagement">岗位管理</el-button>
            <el-button type="warning" @click="handleCompanyProfile">公司资料</el-button>
            <el-button type="info" @click="handlePersonalCenter">个人中心</el-button>
          </div>
        </el-card>
      </el-col>

      <el-col :span="12">
        <el-card>
          <template #header>
            <span>用户功能管理</span>
          </template>
          <div>
            <el-button type="primary" @click="handleUserProfile">用户资料</el-button>
            <el-button type="success" @click="handleUserResume">用户简历</el-button>
            <el-button type="warning" @click="handleUserApplications">用户申请</el-button>
            <el-button type="info" @click="handleUserJobSearch">职位搜索</el-button>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { showCustomMessage } from '../../utils/message'

const router = useRouter()

// 基础管理功能
const handlePosition = () => {
  router.push('/admin/emp-management')
}

const handleCategory = () => {
  showCustomMessage('分类管理功能开发中...', 'info')
}

const handleTag = () => {
  showCustomMessage('标签管理功能开发中...', 'info')
}

const handleCompany = () => {
  router.push('/admin/com-management')
}

// 内容管理功能
const handleResume = () => {
  showCustomMessage('简历管理功能开发中...', 'info')
}

const handleComment = () => {
  showCustomMessage('评论管理功能开发中...', 'info')
}

const handleUser = () => {
  router.push('/admin/user-management')
}

// 运营管理功能
const handleAdvertisement = () => {
  showCustomMessage('广告管理功能开发中...', 'info')
}

const handleNotification = () => {
  showCustomMessage('通知管理功能开发中...', 'info')
}

const handleTest = () => {
  router.push('/admin/test')
}

// 日志管理功能
const handleLoginLog = () => {
  showCustomMessage('登录日志功能开发中...', 'info')
}

const handleOperationLog = () => {
  showCustomMessage('操作日志功能开发中...', 'info')
}

const handleErrorLog = () => {
  showCustomMessage('错误日志功能开发中...', 'info')
}

// 统计分析功能
const handleStatistics = () => {
  showCustomMessage('数据统计功能开发中...', 'info')
}

const handleAnalysis = () => {
  showCustomMessage('数据分析功能开发中...', 'info')
}

// 企业功能管理
const handleDeliveryManagement = () => {
  showCustomMessage('投递管理功能开发中...', 'info')
}

const handlePositionManagement = () => {
  router.push('/admin/emp-management')
}

const handleCompanyProfile = () => {
  router.push('/admin/com-management')
}

const handlePersonalCenter = () => {
  showCustomMessage('个人中心功能开发中...', 'info')
}

// 用户功能管理
const handleUserProfile = () => {
  router.push('/admin/user-management')
}

const handleUserResume = () => {
  showCustomMessage('用户简历功能开发中...', 'info')
}

const handleUserApplications = () => {
  showCustomMessage('用户申请功能开发中...', 'info')
}

const handleUserJobSearch = () => {
  showCustomMessage('职位搜索功能开发中...', 'info')
}
</script>

<style scoped>
.admin-page {
  padding: 20px;
}

.admin-page h1 {
  color: #409eff;
  margin-bottom: 10px;
  font-size: 28px;
}

.admin-page p {
  color: #666;
  margin-bottom: 30px;
  font-size: 16px;
}

.el-card {
  margin-bottom: 20px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.el-card :deep(.el-card__header) {
  background-color: #f5f7fa;
  font-weight: bold;
  color: #303133;
}

.el-button {
  margin-right: 10px;
  margin-bottom: 10px;
  min-width: 100px;
}

.el-row {
  margin-bottom: 20px;
}
</style>
